package com.huaju.enity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * Smsrecord entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "smsrecord", catalog = "licai")
public class Smsrecord implements java.io.Serializable {

	// Fields

	private Integer smsId;
	private Smstype smstype;
	private Admin admin;
	private String content;
	private String mobile;
	private Date sendtime;

	// Constructors

	/** default constructor */
	public Smsrecord() {
	}

	/** minimal constructor */
	public Smsrecord(String content, String mobile) {
		this.content = content;
		this.mobile = mobile;
	}

	/** full constructor */
	public Smsrecord(Smstype smstype, Admin admin, String content,
			String mobile, Date sendtime) {
		this.smstype = smstype;
		this.admin = admin;
		this.content = content;
		this.mobile = mobile;
		this.sendtime = sendtime;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "sms_id", unique = true, nullable = false)
	public Integer getSmsId() {
		return this.smsId;
	}

	public void setSmsId(Integer smsId) {
		this.smsId = smsId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "type_id")
	public Smstype getSmstype() {
		return this.smstype;
	}

	public void setSmstype(Smstype smstype) {
		this.smstype = smstype;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "admin_id")
	public Admin getAdmin() {
		return this.admin;
	}

	public void setAdmin(Admin admin) {
		this.admin = admin;
	}

	@Column(name = "content", nullable = false, length = 256)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "mobile", nullable = false, length = 65535)
	public String getMobile() {
		return this.mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	@Column(name = "sendtime", length = 19)
    @DateTimeFormat(pattern="yyyy-MM-dd hh:mm:ss" ) 
    @JsonFormat(pattern="yyyy-MM-dd hh:mm:ss" ,timezone = "GMT+8")
	public Date getSendtime() {
		return this.sendtime;
	}

	public void setSendtime(Date sendtime) {
		this.sendtime = sendtime;
	}

}